package czxy.dao;

import czxy.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {

    @Select("select  * from teacher_student ts ,student s where  ts.teacher_id = #{tid} and  ts.student_id = #{sid};")
    public List<Student> findStudentsByTid(@Param("tid") Integer tid);



    @Select("select  * from  student where  sid = #{sid}")
    @Results(id ="studentAllInfo"  ,value = {
            @Result(property = "sid",column = "sid"),
            @Result(property = "teacherList",
            many =   @Many(select = "czxy.dao.TacherMapper.findTeachersBySid"),
            column = "sid")
    })
    public  Student findStudentBySid(@Param("sid") Integer sid);









    @Select("select * from student")

    @ResultMap("studentAllInfo")
    public  List <Student> findAllStudentInfo();











}
